﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Mvc;

namespace RentACarRESTApi
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            config.Routes.MapHttpRoute(null, "api/{controller}/{StartDate}/{EndDate}",
                   new { StartDate = RouteParameter.Optional, EndDate = RouteParameter.Optional });

            config.Routes.MapHttpRoute(null, "api/{controller}/{CarId}/{StartDate}/{EndDate}",
                   new { CarId = RouteParameter.Optional, StartDate = RouteParameter.Optional, EndDate = RouteParameter.Optional });
        }
    }
}
